package com.example.runner;

import com.example.dao.mysql.AccountMysqlDao;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/* ━━━━━━佛祖保佑━━━━━━
 *                  ,;,,;
 *                ,;;'(    社
 *      __      ,;;' ' \   会
 *   /'  '\'~~'~' \ /'\.)  主
 * ,;(      )    /  |.     义
 *,;' \    /-.,,(   ) \    码
 *     ) /       ) / )|    农
 *     ||        ||  \)
 *     (_\       (_\
 * ━━━━━━永无BUG━━━━━━
 * @author ：zjq
 * @date ：2020/12/17 10:21
 * @description: TODO
 * @version: V1.0
 * @slogan: 天下风云出我辈，一入代码岁月催
 */
@Component
public class InitializingService implements InitializingBean {

    @Autowired
    private Environment environment;

    @Autowired
    private AccountMysqlDao accountMysqlDao;


    @Override
    public void afterPropertiesSet()  {
        String property = environment.getProperty("aaa.bbb");
        System.out.println("################### InitializingBean   afterPropertiesSet "+accountMysqlDao);
    }

    // 这个 会比 afterPropertiesSet 先执行
    @PostConstruct
    public void test1(){
        String property = environment.getProperty("aaa.bbb");
        System.out.println("3333333333333  PostConstruct 33333"+accountMysqlDao);
    }


}
